package com.baizhi.service.impl;

import com.baizhi.dao.LogDAO;
import com.baizhi.entity.Log;
import com.baizhi.service.LogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class LogServiceImpl implements LogService {
    @Autowired
    private LogDAO logDAO;

    @Override
    public void deleteByPrimaryKey(Integer logId) {
        logDAO.deleteByPrimaryKey(logId);
    }

    @Override
    public void insert(Log record) {
        logDAO.insert(record);
    }

    @Override
    public PageInfo<Log> selectAll(Integer page, Integer limit) {
        PageHelper.startPage(page,limit);
        List<Log> list = logDAO.selectAll();
        PageInfo<Log> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
